/**
 * Copyright (c) 2016-2019 九点科技 All rights reserved.
 *
 * http://www.9dyun.cn
 *
 * 版权所有，侵权必究！
 */
package com.dian.modules.inv.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dian.common.utils.MapUtils;
import com.dian.modules.inv.dao.TranLineDao;
import com.dian.modules.inv.entity.TranHeadEntity;
import com.dian.modules.inv.entity.TranLineEntity;
import com.dian.modules.inv.service.TranLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 调拨单明细服务实现类
 *
 * @author xiaolai
 * @email xiaolai@9dyun.cn
 * @date 2019-06-11 00:17:00
 */
@Service("TranLineService")
public class TranLineServiceImpl extends ServiceImpl<TranLineDao, TranLineEntity> implements TranLineService {
    @Autowired
    public TranLineService tranLineService;

    /**
     *
     * @param tranHeadEntity
     * @return
     */

    @Override
    public boolean updateInfo(TranHeadEntity tranHeadEntity) {
        List<TranLineEntity> lineList=tranHeadEntity.getTranLineEntityList();
        this.removeByMap(new MapUtils().put("tran_id", tranHeadEntity.getId()));
        this.saveBatch(lineList);
        return true;

    }

    @Override
    public boolean deleteInfo(Long id) {
        return this.remove(new QueryWrapper<TranLineEntity>().eq("tran_id",id));

    }

    @Override
    public List<TranLineEntity> queryList(Long id) {
        return this.list(new QueryWrapper<TranLineEntity>().eq("tran_id",id));

    }

}
